﻿using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Sizebox.CharacterEditor
{
	// Token: 0x02000250 RID: 592
	public class MaterialRenderModeOption : MaterialControlOption
	{
		// Token: 0x06000CDB RID: 3291 RVA: 0x00067ACC File Offset: 0x00065CCC
		private void Awake()
		{
			this.dropdown.ClearOptions();
			foreach (string text in this.options)
			{
				this.dropdown.options.Add(new Dropdown.OptionData(text));
			}
			this.dropdown.onValueChanged.AddListener(new UnityAction<int>(this.OnSelection));
		}

		// Token: 0x06000CDC RID: 3292 RVA: 0x00067B38 File Offset: 0x00065D38
		public override void ValidateOption(MaterialEntryGui selected, List<MaterialEntryGui> newWrappers)
		{
			base.ValidateOption(selected, newWrappers);
			if (this.selectedGui == null)
			{
				return;
			}
			bool flag = this.selectedGui.Wrapper.Material.HasProperty("_Mode");
			base.gameObject.SetActive(flag);
			if (flag)
			{
				this.dropdown.value = Mathf.RoundToInt(this.selectedGui.Wrapper.Material.GetFloat("_Mode"));
			}
		}

		// Token: 0x06000CDD RID: 3293 RVA: 0x00067BB8 File Offset: 0x00065DB8
		private void OnSelection(int index)
		{
			if (this.selectedGuis == null)
			{
				return;
			}
			foreach (MaterialEntryGui materialEntryGui in this.selectedGuis)
			{
				materialEntryGui.Wrapper.RenderMode = (float)index;
			}
		}

		// Token: 0x040011DE RID: 4574
		[SerializeField]
		private Dropdown dropdown;

		// Token: 0x040011DF RID: 4575
		[SerializeField]
		private string[] options;

		// Token: 0x040011E0 RID: 4576
		private const string MODE = "_Mode";
	}
}
